#include "ThreadPool.h"
#include <chrono>
#include <cstdio>
#include <iostream>
#include <vector>

int main()
{
    ThreadPool pool(4);
    std::vector<std::future<int>> results;
    for (int i = 0; i < 8; i++)
    {
        results.emplace_back(
            pool.enqueue([i] {
                printf("hello %d\n", i);
                std::this_thread::sleep_for(std::chrono::seconds(1));
                printf("world %d\n", i);
                return i + 1;
            }));
    }
    for (auto &&res : results)
        printf("\"%d\" ", res.get());
    std::cout << std::endl;
    return 0;
}
